class Solution(object):
    def countDistinct(self, s):
        n = len(s)
        a_set = set()
        for i in range(n):
            for j in range(i + 1, n + 1):
                a_set.add(s[i: j])
        return len(a_set)